%MAIN script
filename='./imgs/bike.pgm';
%Codigo=coder(filename)
profile on

%Coding
%A=imread(filename,'PGM'); %Matlab hace esto solo, pero deberiamos implementar nuestra version
%E=model_err(A);
%E2=functionM(E);
%G=coding(E2);%Returns a string of numbers to be coded
%G=adapcoding(E2);

%Decoding & step by step checking
%E2d=uncoding(G); %Checked, works
E2d=adapuncoding(G);
%dist=norm(E2d-E2)

Ed=invfunctionM(E2d); %Checked, works
%dist=norm(Ed-E)

Ad=regenerate_im(Ed); %Done, creo
dist=norm(Ad-double(A))

%Display image
image(uint8(Ad))
